{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "Using TensorFlow backend.\n"
     ]
    }
   ],
   "source": [
    "from keras.models import Sequential\n",
    "from keras.layers import Dense\n",
    "from keras import regularizers\n",
    "from keras.optimizers import Adam, RMSprop\n",
    "from loss import cemse_loss\n",
    "from keras import losses\n",
    "import numpy as np\n",
    "import tensorflow as tf\n",
    "import matplotlib.pyplot as plt\n",
    "\n",
    "custom_loss = cemse_loss()\n",
    "\n",
    "model = Sequential()\n",
    "model.add(Dense(10, use_bias=True, bias_initializer='random_uniform', activation='relu', kernel_regularizer=regularizers.l2(0.01), input_dim=18))\n",
    "model.add(Dense(10, use_bias=True, bias_initializer='random_uniform', activation='relu', kernel_regularizer=regularizers.l2(0.01)))\n",
    "model.add(Dense(9 + 1, use_bias=True, bias_initializer='random_uniform', activation='linear', kernel_regularizer=regularizers.l2(0.01)))\n",
    "model.compile(loss=custom_loss,\n",
    "    optimizer=Adam(lr=0.01))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "state = [1,1,0,0,0,0,0,0,0,0,0,0,-1,-1,0,0,0,0]\n",
    "target = 1\n",
    "next_move = [0,0,0.5,0,0,0.2,0.3,0,0]\n",
    "\n",
    "y_true = np.array([[target] + next_move])\n",
    "\n",
    "training_states = np.array([state])\n",
    "training_targets = y_true"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "fit = model.fit(training_states, training_targets, epochs=1, verbose=0)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'loss': [3.0224502086639404]}"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "fit.history"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 200,
   "metadata": {},
   "outputs": [],
   "source": [
    "for i in range(100):\n",
    "    fit = model.fit(training_states, training_targets, epochs=1, verbose=0)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "y_pred = model.predict(np.array([state]))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [],
   "source": [
    "v = tf.slice(tf.constant(y_pred, dtype='float64'), [0,0], [-1,1])\n",
    "z = tf.slice(tf.constant(y_true, dtype='float64'), [0,0], [-1,1])\n",
    "\n",
    "p = tf.slice(tf.constant(y_pred, dtype='float64'), [0,1], [-1,-1])\n",
    "pi = tf.slice(tf.constant(y_true, dtype='float64'), [0,1], [-1,-1])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [
    {
     "ename": "TypeError",
     "evalue": "Input 'y' of 'NotEqual' Op has type int32 that does not match type float64 of argument 'x'.",
     "output_type": "error",
     "traceback": [
      "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[0;31mTypeError\u001b[0m                                 Traceback (most recent call last)",
      "\u001b[0;32m<ipython-input-20-821feb4fb351>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m()\u001b[0m\n\u001b[1;32m      1\u001b[0m \u001b[0mzero\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mtf\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mconstant\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 2\u001b[0;31m \u001b[0mloc\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mtf\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mnot_equal\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mpi\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mzero\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m      3\u001b[0m \u001b[0msess\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mrun\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mloc\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;32m/Users/davidfoster/.virtualenvs/deepreinforcement/lib/python2.7/site-packages/tensorflow/python/ops/gen_math_ops.pyc\u001b[0m in \u001b[0;36mnot_equal\u001b[0;34m(x, y, name)\u001b[0m\n\u001b[1;32m   2851\u001b[0m   \u001b[0;32mif\u001b[0m \u001b[0m_ctx\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0min_graph_mode\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m   2852\u001b[0m     _, _, _op = _op_def_lib._apply_op_helper(\n\u001b[0;32m-> 2853\u001b[0;31m         \"NotEqual\", x=x, y=y, name=name)\n\u001b[0m\u001b[1;32m   2854\u001b[0m     \u001b[0m_result\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0m_op\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0moutputs\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m   2855\u001b[0m     \u001b[0m_inputs_flat\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0m_op\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0minputs\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;32m/Users/davidfoster/.virtualenvs/deepreinforcement/lib/python2.7/site-packages/tensorflow/python/framework/op_def_library.pyc\u001b[0m in \u001b[0;36m_apply_op_helper\u001b[0;34m(self, op_type_name, name, **keywords)\u001b[0m\n\u001b[1;32m    544\u001b[0m                   \u001b[0;34m\"%s type %s of argument '%s'.\"\u001b[0m \u001b[0;34m%\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m    545\u001b[0m                   (prefix, dtypes.as_dtype(attrs[input_arg.type_attr]).name,\n\u001b[0;32m--> 546\u001b[0;31m                    inferred_from[input_arg.type_attr]))\n\u001b[0m\u001b[1;32m    547\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m    548\u001b[0m           \u001b[0mtypes\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m[\u001b[0m\u001b[0mvalues\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mdtype\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;31mTypeError\u001b[0m: Input 'y' of 'NotEqual' Op has type int32 that does not match type float64 of argument 'x'."
     ]
    }
   ],
   "source": [
    "zero = tf.constant(0, dtype=tf.float64)\n",
    "loc = tf.not_equal(pi, zero)\n",
    "sess.run(loc)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [],
   "source": [
    "loss = losses.mean_squared_error(z, tf.tanh(v)) + tf.nn.softmax_cross_entropy_with_logits(labels = tf.boolean_mask(pi,loc), logits = tf.boolean_mask(p,loc))\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[ 1.42451725]\n",
      "[ 0.5  0.2  0.3]\n",
      "[ 0.09151755 -0.57005888  0.28418985]\n"
     ]
    }
   ],
   "source": [
    "sess = tf.Session()\n",
    "print(sess.run(loss))\n",
    "print(sess.run(tf.boolean_mask(pi,loc)))\n",
    "print(sess.run(tf.boolean_mask(p,loc)))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[[ 0.   0.   0.5  0.   0.   0.2  0.3  0.   0. ]]\n",
      "[[ 0.01390975  0.02305907  0.09151755  0.01204331  0.34318545 -0.57005888\n",
      "   0.28418985  0.05954683  0.06024369]]\n",
      "[[ 0.10593089  0.10690453  0.11447938  0.10573336  0.14723981  0.05907562\n",
      "   0.13880457  0.11087728  0.11095457]]\n",
      "2.24187418139\n",
      "[ 2.24187418]\n"
     ]
    }
   ],
   "source": [
    "print(sess.run(pi))\n",
    "print(sess.run(p))\n",
    "softmax = tf.nn.softmax(p)\n",
    "\n",
    "print(sess.run(softmax))\n",
    "total_loss = tf.reduce_mean(-tf.reduce_sum(pi * tf.log(softmax), [1]))\n",
    "\n",
    "print(sess.run(total_loss))\n",
    "print(sess.run(tf.nn.softmax_cross_entropy_with_logits(labels = pi, logits = p)))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 210,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[ 3.01843262, -3.35358572, -2.37631893,  3.34004378, -2.99087596,\n",
       "        -2.9094696 ,  2.45611715,  2.80245829, -2.63021517, -2.40210104]], dtype=float32)"
      ]
     },
     "execution_count": 210,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "y_pred"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 208,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAJ4AAAD8CAYAAACGuR0qAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMS4wLCBo\ndHRwOi8vbWF0cGxvdGxpYi5vcmcvpW3flQAADPNJREFUeJzt3X/sXXV9x/Hnqy2VFRugoBTabgVX\nWPgxgVSCzjm0G0FmqCb+AYkbziVMFh0sLgZGAol/kY24zc3MEKmyrKITy9YY2NoIzBilSLuWthSx\nMn60KxTElQpjpet7f9xT8+2XW7/3c88593099/VIbnq/93y4n/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HL0jHT7mt\n1cdbevHKhaXwyoWlcPAshYNnKRw8S+HgWQoHz1I4eJbCwbMU/w+cQYM8GRx5AAAAAABJRU5ErkJg\ngg==\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x11d687190>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAX8AAABECAYAAABpjjW9AAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMS4wLCBo\ndHRwOi8vbWF0cGxvdGxpYi5vcmcvpW3flQAAButJREFUeJzt3WuInFcdx/Hvz92kbVJsk2zFmAQT\nrURDVGKXWg2INCmkKOmbCg1YGjWsL6ytRfCOLwQxXvDyQoSQVouWWohB0xK8kfaVELptU2qTpo2p\nNomJza31mtTozxfzxB2mu9myz+yc7Ty/Dyz7PDOH5/w57Pxm9szMObJNREQ0y2tKFxAREb2X8I+I\naKCEf0REAyX8IyIaKOEfEdFACf+IiAaqFf6S5kv6jaRnqt/zJmj3H0l7qp8ddfqMiIj6VOdz/pK+\nAZyyvVnS54B5tj87Tru/2760Rp0REdFFdcN/P/B+20clLQQesr18nHYJ/4iIGaRu+L9g+/LqWMDp\n8+cd7c4Be4BzwGbbP5/geiPACMDgrDlXvXbBm6dcWzfMP/Z00f7Pu2TllaVL4MiJgdIlAHD2X2dK\nl8Dg7FmlSwBAqHQJM8bQ0OzSJTD39J9KlwDA48dOnrB9xWTtJg1/Sb8FXj/OXV8E7m4Pe0mnbb9s\n3l/SIttHJL0J2AWssf2HC/W7YOE7vG7jzsnqn1YbvrmmaP/nrXzq/tIl8KW75pYuAYBnnzhQugSG\nloz3cOi9gYHyT8gzZXmYTR9dWroErt4+UroEAF731R89Ynt4snaDkzWwvXai+yT9RdLCtmmf5ye4\nxpHq90FJDwGrgAuGf0RETJ+6H/XcAdxSHd8C/KKzg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O+B/zS9luBd9LQcZG0CLgNGLa9\nktYHV24qW9X068vwJ0tO/J/to7YfrY7/RusBvqhsVWVIWgx8gNZ3TRpN0mXA+4A7AWy/ZPuFslUV\nNQhcImkQmAP8uXA9065fw38R0L58xGEaGnjtJC0FVgG7y1ZSzHeBzwD/LV3IDLCM1nIrP6ymwbZK\nmlu6qBJsHwG+BTwHHAVetP3rslVNv34N/+gg6VLgZ8CnbP+1dD29JumDwPO2HyldywwxCLwL+IHt\nVcA/gEa+NyZpHq2ZgWXAG4C5kj5ctqrp16/hP+mSE00iaRat4L/H9vbS9RSyGlgv6Y+0pgGvlfST\nsiUVdRg4bPv8f4HbaD0ZNNFa4Fnbx23/G9gOvLdwTdOuX8N/0iUnmkKSaM3r7rP97dL1lGL787YX\n215K6+9hl+2+f3U3EdvHgEOSllc3rQE69+BoiueAayTNqR4va2jAm9+9WtWzpyZacqJwWaWsBm4G\nnpC0p7rtC7Z3FqwpZoZPAvdUL5AOAh8pXE8RtndL2gY8SuvTcY/RgKUesrxDREQD9eu0T0REXEDC\nPyKigRL+ERENlPCPiGighH9ERAMl/CMiGijhHxHRQP8DIhEvVpr4RvwAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x11de63710>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAPgAAAD8CAYAAABaQGkdAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMS4wLCBo\ndHRwOi8vbWF0cGxvdGxpYi5vcmcvpW3flQAACuZJREFUeJzt3VFoneUdx/Hfr0k7bbTWzgralrUM\ncXSOUQmidhNmvdDpdBu7qKAwhfVm1ipuortxN7sT0QsnC1UvZlFYrCAi6kCF7aYztoKmUSltl7ZW\nGhGNBEba5b+LnEEVm/O2eR7fnD/fDxR6Tk+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z0u6\nJyIm257nVGzfJOlYRLzd9iwN9Eu6XNITEbFB0pSkhXw95nzNnmmuk3SxpAHbt7U71dzaCvyIpDUn\n3V7duW9Bsr1Ys3HviIidbc/TxUZJN9s+qNmXPtfafqbdkU7psKTDEfH/M6JhzQa/UF0n6UBETETE\ncUk7JV3d8kxzaivwtyRdYnud7SWavVDxYkuzzMm2NfsacSwiHml7nm4i4sGIWB0RazX7vL4eEQvy\nKBMRH0s6ZPvSzl2bJO1tcaRuxiVdaXtp5+tikxbwRUFp9hTpGxcRJ2zfJelVzV6JfCoiRtuYpYGN\nkm6X9K7tdzr3/SEiXm5xpky2StrR+Y9+v6Q7Wp7nlCJil+1hSbs1++7KHi3wT7XxSTYgMS6yAYkR\nOJAYgQOJETiQGIEDiRE4kBiBA4kROJDY/wCkjFb6yvMkPQAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x11e75ca90>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAX8AAABECAYAAABpjjW9AAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMS4wLCBo\ndHRwOi8vbWF0cGxvdGxpYi5vcmcvpW3flQAABvNJREFUeJzt3X+o3XUdx/Hnyzubzo15S6G5jW1l\nTEdl01HWIMxNUIr5j4FC4qKx/sg0Gf2GiAhaEf34I4SxFVFiwpKaMcpkGkE0vM2FubW2Vrm7Vs6t\nOVM2vfPVH+e77uF4r3fc77nncz3f1wMu9/v9ng/fz5sPO6979j3f7+cj20RERLOcV7qAiIjovYR/\nREQDJfwjIhoo4R8R0UAJ/4iIBkr4R0Q0UK3wl/RGSb+WtL/6PThOuzOSdlc/2+r0GRER9anOff6S\nvgEct71R0ueAQdufHaPdf23PrlFnRER0Ud3w3wdcZ/uIpHnAY7aXjtEu4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tuHxjjX\nemB9tbsU2FerOLgEeLbmOfpFxmJUxmJUxmJUv4zFItuXTtSoKxO7nYOHgPttn5b0cVpLOl7f2cj2\nJmBTtzqVNGR7RbfO93qWsRiVsRiVsRjVtLHoyWIuto/ZPl3tbgau6UK/ERExST1ZzEXSvLbdNcDe\nLvQbERGT1KvFXO6StAYYobWYy9q6/Z6jrl1C6gMZi1EZi1EZi1GNGovaX/hGRMTrT57wjYhooIR/\nREQD9W34TzTlRFNIWijpUUl7JD0l6e7SNZUkaUDSE5J+UbqW0iRdLGmrpD9L2ivpvaVrKkXSPdX7\n40+S7pd0Qemaplpfhn/blBM3AcuA2yQtK1tVMSPABtvLgGuBTzR4LADuJnebnfVd4Je2rwCuoqHj\nImk+cBewwvbbad24cmvZqqZeX4Y/mXLi/2wfsb2r2n6e1ht8ftmqypC0APggrWdNGk3SXOD9wBYA\n2y/ZPlG2qqJmABdKmgHMAv5ZuJ4p16/hPx9onz5imIYGXjtJi4HlwM6ylRTzHeAzwCulC5kGltCa\nbuUH1WWwzZIuKl1UCbYPA98EngaOAM/ZfrhsVVOvX8M/OkiaDfwU+JTtk6Xr6TVJHwKesf2H0rVM\nEzOAq4F7bS8HXgAa+d2YpEFaVwaWAJcBF0n6SNmqpl6/hv+EU040iaTzaQX/fbYfLF1PISuBNZL+\nTusy4PWSfly2pKKGgWHbZ/8XuJXWH4MmWg38zfZR2y8DDwLvK1zTlOvX8J9wyommkCRa13X32v5W\n6XpKsf152wtsL6b172GH7b7/dDce2/8CDklaWh1aBXSuwdEUTwPXSppVvV9W0YAvv3s1q2dPjTfl\nROGySlkJ3A48KWl3dewLtrcXrCmmh08C91UfkA4CHy1cTxG2d0raCuyidXfcEzRgqodM7xAR0UD9\netknIiJeQ8I/IqKBEv4REQ2U8I+IaKCEf0REAyX8IyIaKOEfEdFA/wOFPjMwdv23mQAAAABJRU5E\nrkJggg==\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x11d26b350>"
      ]
     },
     "metadata": {},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JDYfwGBbYhPclscCgAAAABJRU5E\nrkJggg==\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x11d5d7590>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAX8AAABECAYAAABpjjW9AAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMS4wLCBo\ndHRwOi8vbWF0cGxvdGxpYi5vcmcvpW3flQAABvBJREFUeJzt3W+MVFcdxvHvIwi1EFtamkihKRAr\nSjSGlmiFxGihCY2GvqlJiTbFSLaJra2Nif/ji74RjdH6wpgQqjG1QRLaKDbEf4H6QhPs2mKw0LVI\nlT9iC7T0DxFw7eOLubiTcbdL9s7O2c59Pslm771zcs9vz848O3tn5hzZJiIimuVNpQuIiIjeS/hH\nRDRQwj8iooES/hERDZTwj4hooIR/REQD1Qp/SZdJ+rWkZ6rvc8Zo9x9Je6qv7XX6jIiI+lTnff6S\nvgm8YHujpC8Cc2x/YZR2r9qeXaPOiIjoorrhPwR8yPYxSfOAx2wvGaVdwj8iYgqpG/6nbF9abQt4\n8fx+R7thYA8wDGy0/dMxzjcADADMmjnjundcOXfCtXXDobNXFO3/vDOn/1W6BK6Z/WLpEgA4eKb8\n76R1Vy9v8eXl7xevDB0tXQIAz122uHQJ+LWpMVvCq6eePmF73AfK9PEaSPoN8LZRbvpK+45tSxrr\np7/a9lFJi4Gdkvba/mtnI9ubgE0A1y6e79/d9+nxyptUdz47ULT/84b+sK90CTy6YmvpEgBYN3RH\n6RKYcdHM0iUAsOXje0uXwK4Pf7V0CQDcv+bB0iUwfPZc6RIA+O3DK/5+Ie3GDX/bq8e6TdJzkua1\nXfZ5foxzHK2+H5T0GLAM+L/wj4iI3qj7Vs/twO3V9u3AzzobSJojaWa1PRdYCZR/KhsR0WB1w38j\ncKOkZ4DV1T6Slkv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X4Y/mXLif2wfs/1Etf0KrQf4/LJVlSFpAfARWp81aTRJlwAfBB4AsH3O\n9qmyVRU1HXiLpOnAxcA/Ctcz6fo1/OcD7dNHHKGhgddO0kJgGbC7bCXF3A98HnitdCFTwCJa0638\nsLoMtlnSrNJFlWD7KPAt4BBwDHjJ9q/KVjX5+jX8o4Ok2cDDwGdtv1y6nl6T9FHgedt/LF3LFDEd\nuBb4vu1lwGmgka+NSZpD68rAIuBKYJakT5StavL1a/iPO+VEk0h6M63gf8j2I6XrKWQlsFbS32hd\nBrxB0o/LllTUEeCI7fP/BW6j9cegiVYDz9o+bvvfwCPAisI1Tbp+Df9xp5xoCkmidV13v+1vl66n\nFNtfsr3A9kJa94edtvv+2d1YbP8TOCxpSXVoFdC5BkdTHAKul3Rx9XhZRQNe/O7VrJ49NdaUE4XL\nKmUlcBuwV9Ke6tiXbe8oWFNMDZ8BHqqeIB0EPlm4niJs75a0DXiC1rvjnqQBUz1keoeIiAbq18s+\nERHxOhL+ERENlPCPiGighH9ERAMl/CMiGijhHxHRQAn/iIgG+i97EzZCeqMfNQAAAABJRU5ErkJg\ngg==\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x11de21e50>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "l1 = model.layers[0].get_weights()[0]\n",
    "l1_bias = [model.layers[0].get_weights()[1]]\n",
    "l2 = model.layers[1].get_weights()[0]\n",
    "l2_bias = [model.layers[1].get_weights()[1]]\n",
    "l3 = model.layers[2].get_weights()[0]\n",
    "l3_bias = [model.layers[2].get_weights()[1]]\n",
    "plt.imshow(l1, cmap='coolwarm')\n",
    "plt.show()\n",
    "plt.imshow(l1_bias, cmap='coolwarm')\n",
    "plt.show()\n",
    "plt.imshow(l2, cmap='coolwarm')\n",
    "plt.show()\n",
    "plt.imshow(l2_bias, cmap='coolwarm')\n",
    "plt.show()\n",
    "plt.imshow(l3, cmap='coolwarm')\n",
    "plt.show()\n",
    "plt.imshow(l3_bias, cmap='coolwarm')\n",
    "plt.show()\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 209,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[  1.63326238e-03,   3.16449344e-01,   5.86463630e-01,\n",
       "         -2.01987638e-03,  -8.03918540e-02,   3.22499429e-03,\n",
       "         -6.76295953e-04,   2.31270387e-04,  -3.93889584e-02,\n",
       "          2.98810769e-02],\n",
       "       [  3.74790933e-03,   3.19886327e-01,   4.97435331e-01,\n",
       "          3.93377207e-02,   2.33290941e-01,   1.85876188e-03,\n",
       "          1.30566055e-04,  -1.97542031e-05,   4.09340054e-01,\n",
       "          2.29218248e-02],\n",
       "       [ -1.79458119e-03,  -7.36567250e-04,  -1.68336974e-03,\n",
       "          7.71252380e-05,  -7.27214792e-04,  -1.60337469e-04,\n",
       "          1.77326205e-03,  -5.33297658e-04,  -4.45837097e-04,\n",
       "          6.06847927e-04],\n",
       "       [  4.75142151e-04,   1.94792147e-03,  -7.74591172e-07,\n",
       "          1.94060453e-03,   2.14025122e-03,   6.62030216e-05,\n",
       "          1.41475582e-04,  -5.88265713e-04,  -1.95807265e-03,\n",
       "         -9.69951361e-05],\n",
       "       [  2.84593494e-04,  -7.40125368e-04,   7.38236587e-04,\n",
       "         -1.95917371e-03,   1.32156827e-04,  -1.22703519e-03,\n",
       "         -4.18331986e-03,   2.72949343e-04,  -1.80080751e-04,\n",
       "          6.15868601e-04],\n",
       "       [ -1.69476116e-05,  -9.67179483e-04,   1.40215707e-06,\n",
       "          2.37035274e-04,   1.08089461e-03,   6.38876925e-04,\n",
       "         -3.07213422e-03,   1.75490987e-03,   1.50778258e-04,\n",
       "         -1.87554397e-03],\n",
       "       [ -7.81350536e-04,   7.89463229e-07,   1.02843063e-04,\n",
       "         -3.00052529e-03,   3.01247201e-04,  -1.14033069e-03,\n",
       "          3.54149306e-05,  -1.68544566e-03,  -2.89741135e-03,\n",
       "         -4.90532373e-04],\n",
       "       [  4.61248169e-03,   5.95118268e-04,  -4.35080286e-03,\n",
       "          4.57971240e-04,   2.50914192e-04,   9.95574752e-04,\n",
       "         -1.81498544e-04,   3.75931663e-03,  -8.47270639e-05,\n",
       "          9.55671072e-04],\n",
       "       [  4.09419695e-03,  -6.91802008e-04,   3.37542850e-04,\n",
       "          2.89478805e-04,  -7.90580816e-04,   1.16744905e-03,\n",
       "          1.89099199e-04,   7.25450300e-05,   5.39307366e-04,\n",
       "         -6.75208285e-04],\n",
       "       [ -7.41342519e-05,   1.89158600e-03,  -1.59170682e-04,\n",
       "         -1.13746384e-03,   1.88069663e-03,   3.51590024e-05,\n",
       "         -1.20351347e-03,   1.02841621e-03,  -2.52223050e-04,\n",
       "         -5.71289391e-04],\n",
       "       [ -3.75415402e-05,  -1.55794260e-06,  -4.55596577e-03,\n",
       "          4.38807532e-03,   7.76244910e-04,   5.12352388e-04,\n",
       "          3.08484916e-04,   4.21317643e-04,   4.49988898e-03,\n",
       "         -1.38257499e-04],\n",
       "       [ -3.62292049e-05,  -8.12688522e-05,   3.45208042e-04,\n",
       "         -1.95627520e-03,  -9.88077256e-04,   1.78457424e-03,\n",
       "         -1.65861542e-03,   3.94518982e-04,   7.82087562e-04,\n",
       "          8.21604772e-06],\n",
       "       [ -3.63035873e-03,  -2.94502497e-01,  -3.34966332e-01,\n",
       "          3.71005340e-03,   4.57581818e-01,  -1.37329195e-03,\n",
       "          1.70347223e-04,  -1.86926778e-03,  -7.26208016e-02,\n",
       "         -2.85171028e-02],\n",
       "       [ -1.72299042e-03,  -3.17751557e-01,  -4.82379079e-01,\n",
       "          6.70907944e-02,  -8.06102678e-02,   2.82194203e-04,\n",
       "         -1.10312772e-04,   5.95521415e-05,  -4.93049175e-01,\n",
       "         -1.72092691e-02],\n",
       "       [  1.96311681e-04,   1.97618129e-03,   1.12727087e-03,\n",
       "         -1.62933444e-04,  -7.34310132e-04,  -3.87770357e-04,\n",
       "         -2.34144216e-04,  -2.02960437e-05,  -1.01767248e-03,\n",
       "         -3.51970448e-05],\n",
       "       [ -1.83264507e-04,  -5.12971485e-04,  -1.33233465e-04,\n",
       "          1.89479289e-03,  -9.85731254e-04,   5.49553020e-04,\n",
       "         -4.88846053e-05,   5.93018951e-04,  -1.70807238e-04,\n",
       "         -4.25323175e-04],\n",
       "       [ -1.05608627e-03,  -1.45533343e-03,  -3.77990725e-03,\n",
       "          4.42105997e-03,   5.00839844e-04,  -1.96086336e-03,\n",
       "          9.53009934e-04,   1.91947818e-03,   5.23374649e-04,\n",
       "          2.58291839e-05],\n",
       "       [ -1.82355300e-03,  -3.29327933e-03,   9.11658135e-05,\n",
       "          1.93507108e-03,  -1.61876704e-03,  -2.67736427e-03,\n",
       "         -4.41248249e-03,  -8.72806646e-04,   3.77288810e-03,\n",
       "         -8.40242938e-05]], dtype=float32)"
      ]
     },
     "execution_count": 209,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "model.layers[0].get_weights()[0]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "deepreinforcement",
   "language": "python",
   "name": "deepreinforcement"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.13"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
